﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddContatos.aspx.cs" Inherits="NewTierra.Pages.AddContatos" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

    <link rel="shortcut icon" href="../../images/Icones/favicon.ico" type="image/x-icon" />

    <link href="../../Styles/jquery_notification.css" rel="stylesheet" />

    <script type="text/javascript" src="../../Scripts/jquery_notification_v.1.js"></script>

    <link href="../../Styles/EstiloGeral.css" rel="stylesheet" type="text/css" />


    <title></title>
    <style type="text/css">
        #FormContatos
        {
            height: 297px;
            width: 899px;
        }

            #FormContatos .GridContatos
            {
                float: left;
                height: 240px;
                width: 424px;
                margin-top: 10px;
            }

            #FormContatos .FormCadastroContatos
            {
                float: left;
                width: 452px;
                height: 307px;
            }

        .invisible
        {
            display: none;
        }

        .btnAddContato
        {
            height: 39px;
        }
    </style>

    <script type="text/javascript">
        function showAutoCloseMessage(MsgsExc) {
            showNotification({
                message: MsgsExc,
                autoClose: true,
                type: "success",
                duration: 5
            });
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server" />

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>

                <div id="FormContatos">

                    <div class="FormCadastroContatos">

                        <fieldset style="height: 282px">
                            <legend>Cadastrar Contatos</legend>

                            <asp:TextBox ID="txtCodigo" CssClass="invisible" runat="server" ReadOnly="True" Width="50px" />

                            <asp:Label ID="lblNomeContatoTXT" runat="server" Text="Nome:"></asp:Label>
                            <br />
                            <asp:TextBox ID="txtNome" runat="server" Width="200px" MaxLength="50" />
                            <asp:RequiredFieldValidator ID="requireNome" runat="server"
                                ControlToValidate="txtNome" ErrorMessage="*" ForeColor="Red"
                                ToolTip="Campo requerido." ValidationGroup="Salvar">
                            </asp:RequiredFieldValidator>
                            <br />

                            <asp:Label ID="lblTelefoneTXT" runat="server" Text="Telefone:"></asp:Label>
                            <br />
                            <asp:TextBox ID="txtTelefone" runat="server" Width="150px" MaxLength="15" />
                            <asp:RequiredFieldValidator ID="requireTelefone" runat="server"
                                ControlToValidate="txtTelefone" ErrorMessage="*" ForeColor="Red"
                                ToolTip="Campo requerido." ValidationGroup="Salvar">
                            </asp:RequiredFieldValidator>
                            <%--<asp:RegularExpressionValidator
                                ID="ReTelefone"
                                runat="server"
                                ErrorMessage="*"
                                ControlToValidate="txtTelefone"
                                ToolTip="Telefone inválido"
                                ValidationGroup="Salvar"
                                ValidationExpression="[0-9+]{3} [0-9]{2} [0-9]{4}-[0-9]{4}" />--%>
                            <br />

                            <asp:Label ID="lblCargoTXT" runat="server" Text="Cargo:"></asp:Label>
                            <br />
                            <asp:TextBox ID="txtCargo" runat="server" Width="150px" MaxLength="20" />
                            <asp:RequiredFieldValidator ID="requireCargo" runat="server"
                                ControlToValidate="txtCargo" ErrorMessage="*" ForeColor="Red"
                                ToolTip="Campo requerido." ValidationGroup="Salvar">
                            </asp:RequiredFieldValidator>
                            <br />

                            <asp:Label ID="lblEmailTXT" runat="server" Text="Email:"></asp:Label>
                            <br />
                            <asp:TextBox ID="txtEmail" runat="server" Width="200px" MaxLength="50" />
                            <asp:RequiredFieldValidator ID="requireEmail" runat="server"
                                ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red"
                                ToolTip="Campo requerido." ValidationGroup="Salvar">
                            </asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="regularEmail" runat="server"
                                ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red"
                                ToolTip="Email inválido."
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                ValidationGroup="Salvar">
                            </asp:RegularExpressionValidator>
                            <br />
                            <br />

                            <asp:Label ID="lblSupplierTXT" runat="server" Text="Supplier:"></asp:Label>&nbsp;
         <asp:Label ID="lblSupplier" runat="server" Font-Size="Small"></asp:Label>
                            <br />
                            <br />

                            <div class="btnAddContato">
                                <asp:Button ID="btnNovoContato" CssClass="btnsGeral" runat="server" Text="Salvar" ValidationGroup="Salvar" OnClick="SalvarContato" />
                                <asp:Button ID="btnUpdateContato" CssClass="btnsGeral" runat="server" OnClick="EditarContato" Text="Atualizar" ValidationGroup="Salvar" />                                
                                <asp:Button ID="btnLimpar" CssClass="btnsGeral" runat="server" Text="Limpar" OnClick="Limpar" />
                                <asp:Button ID="btnFechar" CssClass="btnsGeral" runat="server" OnClientClick="window.close();" Text="Fechar" />
                            </div>

                            <asp:Label ID="lblMsgAddContato" runat="server" Font-Bold="True" ForeColor="#CC0000" Font-Size="Small"></asp:Label>

                        </fieldset>
                    </div>

                    <div class="GridContatos">


                        <asp:GridView ID="GridContatos" runat="server" AllowPaging="True"
                            AutoGenerateColumns="False" GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr"
                            AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="PaginarDados" EmptyDataText="Não existe contato para esse Supplier."
                            Height="16px" OnSelectedIndexChanged="GridContatos_SelectedIndexChanged" PageSize="8">
                            <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>

                            <Columns>
                                <asp:BoundField DataField="SCONT_id" HeaderText="ID" ReadOnly="True"
                                    SortExpression="SCONT_id" InsertVisible="False"
                                    FooterStyle-CssClass="invisible"
                                    HeaderStyle-CssClass="invisible"
                                    ItemStyle-CssClass="invisible">

                                    <FooterStyle CssClass="invisible" />
                                    <HeaderStyle CssClass="invisible" />
                                    <ItemStyle CssClass="invisible" />
                                </asp:BoundField>

                                <asp:BoundField DataField="SCONT_nome" HeaderText="Nome"
                                    SortExpression="SCONT_nome" />

                                <asp:BoundField DataField="SCONT_telefone" HeaderText="Telefone"
                                    SortExpression="SCONT_telefone" />

                                <asp:BoundField DataField="SCONT_position" HeaderText="Cargo"
                                    SortExpression="SCONT_position" />

                                <asp:BoundField DataField="SCONT_email" HeaderText="Email"
                                    SortExpression="SCONT_email" />


                                <asp:CommandField SelectText="Editar"
                                    ShowSelectButton="True" ButtonType="Image" SelectImageUrl="~/images/Icones/edit.png" />

                                <asp:TemplateField HeaderText="">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="ExluirContato"
                                            runat="server" CommandArgument='<%# Eval("SCONT_id") %>'
                                            OnCommand="ExluirContato"
                                            ToolTip="Excluir Contato" ImageUrl="~/images/Icones/delete.png" />
                                    </ItemTemplate>
                                    <HeaderStyle Wrap="False" />
                                    <ItemStyle Wrap="False" />
                                </asp:TemplateField>

                            </Columns>

                            <PagerStyle CssClass="pgr"></PagerStyle>

                        </asp:GridView>

                    </div>

                </div>

            </ContentTemplate>
        </asp:UpdatePanel>

    </form>
</body>
</html>
